package com.newtouch.bxzs.policy.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.newtouch.bxzs.common.base.model.Policy;
import com.newtouch.bxzs.policy.model.vo.InsuranceNoticeVO;
import com.newtouch.bxzs.policy.model.vo.RenewalNoticeVO;
import com.newtouch.bxzs.policy.model.vo.SuccessfulSurrenderNoticeVO;
import com.newtouch.bxzs.policy.model.vo.SurrenderNoticeVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;

/**
 * 保险端保单通知Mapper
 *
 * <p>
 * <b>History:</b>
 * <table border="1">
 * <tr>
 * <th>Date</th>
 * <th>Operator</th>
 * <th>Memo</th>
 * </tr>
 * <tr>
 * <td>2021/2/5 17:22</td>
 * <td>linhongxi</td>
 * <td>Create</td>
 * </tr>
 * </table>
 *
 * @author linhongxi
 * @version 1.0.0
 * @since 1.0.0
 */
@Mapper
public interface PolicyNoticeMapper extends BaseMapper<Policy> {

    /**
     * 保险端根据保单号修改保单状态-退保申请
     *
     * @param surrenderNoticeVO，Date createTime
     * @return
     */
    int updateSurrenderApplicationPolicy(@Param("surrenderNoticeVO") SurrenderNoticeVO surrenderNoticeVO,
                                         @Param("date") Date date,
                                         @Param("relationId") String relationId);

    /**
     * 保险端根据保单号修改保单状态-退保成功
     *
     * @param successfulSurrenderNoticeVO，Date createTime
     * @return
     */
    int updateSurrenderPolicy(@Param("successfulSurrenderNoticeVO") SuccessfulSurrenderNoticeVO successfulSurrenderNoticeVO,
                              @Param("date") Date date,
                              @Param("relationId") String relationId);

    /**
     * 保险端根据保单号修改保单状态-续保通知
     *
     * @param renewalNoticeVO，Date createTime
     * @date
     */
    int updateRenewalPolicy(@Param("renewalNoticeVO") RenewalNoticeVO renewalNoticeVO,
                            @Param("date") Date date,
                            @Param("relationId") String relationId);

    /**
     * 保险端根据保单号修改保单状态-满期通知
     *
     * @param insuranceNoticeVO，Date createTime
     * @return
     */
    int updateExpirationPolicy(@Param("insuranceNoticeVO") InsuranceNoticeVO insuranceNoticeVO,
                               @Param("date") Date date,
                               @Param("relationId") String relationId);

    /**
     * 查询三方关系是否存在
     *
     * @param insuranceNoticeVO
     * @return
     */
    String selectRelation(@Param("insuranceNoticeVO") InsuranceNoticeVO insuranceNoticeVO);


    /**
     * 根据用户工号获取用户id
     * @param userJobNumber
     * @return
     */
    String getUserIdByUserJobNumber(String userJobNumber);
}
